package com.itheima.demo4tcp1;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class TcpDemo1
{
    public static void main(String[] args) throws Exception {
        //创建Socket管道对象 请求和服务器连接
        Socket socket = new Socket("127.0.0.1", 10086);
        //从Socket管道中获取字节输入流
        DataInputStream dis = new DataInputStream(socket.getInputStream());
        //从Socket管道中获取字节输出流
        DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
        //写入数据
        dos.writeUTF("hello,tcp");
        dos.writeInt(18);
    }
}
